package obiektyturystyczne;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.DefaultTableModel;
import com.google.code.geocoder.*;
import com.google.code.geocoder.model.GeocodeResponse;
import com.google.code.geocoder.model.GeocoderRequest;
import com.google.code.geocoder.model.GeocoderResult;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.math.MathContext;
import java.sql.*;
import java.util.LinkedList;
import java.util.List;
import javax.swing.*;

/**

 @author user
 */
public class MainWindow extends javax.swing.JFrame {

	String connectionString, login, password;
	Connection connection;
	Statement statement;
	IndeksWartosc[] atrakcje;
	IndeksWartosc[] typyObiektu;
	IndeksWartosc[] wyposazenie;
	DefaultListModel list = new DefaultListModel();
	DefaultTableModel table;
	JCheckBox[] boxesAtr;
	JCheckBox[] boxesWyp;
	JTable t;

	public Connection getConnection() throws SQLException {
		if (connection != null && !connection.isClosed()) {
		} else {
			connection = DriverManager.getConnection(connectionString, login, password);
			SqlQueries.statement = connection.createStatement();
			loadAtrakcje1();
			loadWyposazenie1();
			loadTypyObiektow();
		}
		return connection;
	}

	public MainWindow() {
		initComponents();
		//table = (DefaultTableModel) tablePokoje.getModel
		t = tablePokoje;
		jTabbedPane1.setVisible(false);

	}
	int idToUpdate = -1;

	public void przepisz(int ind, String nazwa, String adres, String tel, String www, String lat, String lng) {
		idToUpdate = ind;
		textFieldAdres.setText(adres);
		textFieldDlugosc.setText(lng);
		textFieldNazwa.setText(nazwa);
		textFieldSzerokosc.setText(lat);
		textFieldTelefon.setText(tel);
		textFieldWWW.setText(www);
		jTabbedPane1.setSelectedIndex(1);
		buttonUpdate.setEnabled(true);
		buttonDelete.setEnabled(true);
	}

	private void loadAtrakcje1() {
		try {
			int size = SqlQueries.Count("atrakcje");
			ResultSet result = SqlQueries.Wszystkie("atrakcje");
			boxesAtr = new JCheckBox[2 * size];
			panelAtrakcje.setLayout(new GridLayout(size, 1));
			panelAtrakcje1.setLayout(new GridLayout(size, 1));
			atrakcje = new IndeksWartosc[size];
			for (int i = 0; result.next(); ++i) {
				atrakcje[i] = new IndeksWartosc(result.getInt("id"), result.getString("opis"));
				boxesAtr[i] = new JCheckBox(atrakcje[i].wartosc);
				boxesAtr[i].setName(atrakcje[i].indeks + "");
				boxesAtr[i].setToolTipText(atrakcje[i].wartosc);
				boxesAtr[2 * i + 1] = new JCheckBox(atrakcje[i].wartosc);
				boxesAtr[2 * i + 1].setName(atrakcje[i].indeks + "");
				boxesAtr[2 * i + 1].setToolTipText(atrakcje[i].wartosc);
				panelAtrakcje1.add(boxesAtr[i], atrakcje[i]);
				panelAtrakcje.add(boxesAtr[2 * i + 1], atrakcje[i]);
			}
		} catch (SQLException ex) {
			JOptionPane.showMessageDialog(null, ex.getMessage());
		}
	}

	private void loadWyposazenie1() {
		try {
			int size = SqlQueries.Count("wyposazenie");
			ResultSet result = SqlQueries.Wszystkie("wyposazenie");
			boxesWyp = new JCheckBox[2 * size];
			panelWyposazenie.setLayout(new GridLayout(size, 1));
			panelWyposazenie1.setLayout(new GridLayout(size, 1));
			wyposazenie = new IndeksWartosc[size];
			for (int i = 0; result.next(); ++i) {
				wyposazenie[i] = new IndeksWartosc(result.getInt("id"), result.getString("opis"));
				boxesWyp[i] = new JCheckBox(wyposazenie[i].wartosc);
				boxesWyp[i].setName(wyposazenie[i].indeks + "");
				boxesWyp[i].setToolTipText(wyposazenie[i].wartosc);
				boxesWyp[2 * i + 1] = new JCheckBox(wyposazenie[i].wartosc);
				boxesWyp[2 * i + 1].setName(wyposazenie[i].indeks + "");
				boxesWyp[2 * i + 1].setToolTipText(wyposazenie[i].wartosc);
				panelWyposazenie.add(boxesWyp[2 * i + 1]);
				panelWyposazenie1.add(boxesWyp[i]);
			}
		} catch (SQLException ex) {
			JOptionPane.showMessageDialog(null, ex.getMessage());
		}
	}

	private void loadTypyObiektow() {
		try {
			int size = SqlQueries.Count("typy_obiektow");
			ResultSet result = SqlQueries.Wszystkie("typy_obiektow");
			typyObiektu = new IndeksWartosc[size];
			panelTypyObiektu.setLayout(new GridLayout(size, 1));
			JCheckBox[] boxes = new JCheckBox[size];
			for (int i = 0; result.next(); ++i) {


				typyObiektu[i] = new IndeksWartosc(result.getInt("id"), result.getString("opis"));
				boxes[i] = new JCheckBox(typyObiektu[i].wartosc);
				boxes[i].setName(typyObiektu[i].indeks + "");
				panelTypyObiektu.add(boxes[i]);
				comboBoxTypyObiektu.addItem(typyObiektu[i]);
				//comboBoxTypyObiektu1.addItem(typyObiektu[i]);

			}
		} catch (SQLException ex) {
			JOptionPane.showMessageDialog(null, ex.getMessage());
		}
	}

	/**
	 This method is called from within the constructor to initialize the form.
	 WARNING: Do NOT modify this code. The content of this method is always
	 regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        polaczZBaza = new javax.swing.JDialog();
        polaczLabel = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        adresTextField = new javax.swing.JTextField();
        portTextField = new javax.swing.JTextField();
        bazaTextField = new javax.swing.JTextField();
        hasloTextField = new javax.swing.JTextField();
        loginTextField = new javax.swing.JTextField();
        testPolaczeniaButton = new javax.swing.JToggleButton();
        polaczButton = new javax.swing.JToggleButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        errorTextArea = new javax.swing.JTextArea();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        panelObiekty = new javax.swing.JPanel();
        textFieldSzukaj = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        checkBoxNazwa = new javax.swing.JCheckBox();
        checkBoxAdres = new javax.swing.JCheckBox();
        checkBoxTelefon = new javax.swing.JCheckBox();
        checkBoxWWW = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        panelAtrakcje = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        panelWyposazenie = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        buttonSzukaj = new javax.swing.JButton();
        textFieldWPoblizu = new javax.swing.JTextField();
        jSpinner1 = new javax.swing.JSpinner();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        textFieldLon = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        textFieldLat = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jScrollPane4 = new javax.swing.JScrollPane();
        panelTypyObiektu = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jLabel14 = new javax.swing.JLabel();
        panelDodajObiekt = new javax.swing.JPanel();
        labelNazwa = new javax.swing.JLabel();
        textFieldNazwa = new javax.swing.JTextField();
        labelAdres = new javax.swing.JLabel();
        textFieldAdres = new javax.swing.JTextField();
        labelTelefon = new javax.swing.JLabel();
        textFieldTelefon = new javax.swing.JTextField();
        labelWWW = new javax.swing.JLabel();
        textFieldWWW = new javax.swing.JTextField();
        labelDlugosc = new javax.swing.JLabel();
        textFieldDlugosc = new javax.swing.JTextField();
        labelSzerokosc = new javax.swing.JLabel();
        textFieldSzerokosc = new javax.swing.JTextField();
        labelTyp = new javax.swing.JLabel();
        comboBoxTypyObiektu = new javax.swing.JComboBox();
        buttonZapisz = new javax.swing.JButton();
        labelAtrakcje = new javax.swing.JLabel();
        scrollPaneAtrakcje = new javax.swing.JScrollPane();
        panelAtrakcje1 = new javax.swing.JPanel();
        scrollPanePokoje = new javax.swing.JScrollPane();
        tablePokoje = new javax.swing.JTable();
        labelWyposazenie1 = new javax.swing.JLabel();
        scrollPaneWyposazenie1 = new javax.swing.JScrollPane();
        panelWyposazenie1 = new javax.swing.JPanel();
        buttonUsunWiersz = new javax.swing.JButton();
        buttonDodajWiersz = new javax.swing.JButton();
        labelMiejscowosc = new javax.swing.JLabel();
        textFieldMiejscowosc = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        buttonUpdate = new javax.swing.JButton();
        buttonDelete = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuPlik = new javax.swing.JMenu();
        menuItemConnect = new javax.swing.JMenuItem();
        menuItemZamknij = new javax.swing.JMenuItem();
        menuPomoc = new javax.swing.JMenu();
        menuItemAbout = new javax.swing.JMenuItem();

        polaczZBaza.setMinimumSize(new java.awt.Dimension(400, 307));
        polaczZBaza.setModal(true);

        polaczLabel.setText("Połącz z bazą danych PostgreSQL");

        jLabel7.setText("Adres serwera");

        jLabel10.setText("Port");

        jLabel11.setText("Baza danych");

        jLabel12.setText("Login");

        jLabel13.setText("Hasło");

        adresTextField.setText("localhost");

        portTextField.setText("9999");

        bazaTextField.setText("zztbak01");

        hasloTextField.setText("nun4ALnXqCzn");

        loginTextField.setText("zztbak01");

        testPolaczeniaButton.setText("Test połączenia");
        testPolaczeniaButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                testPolaczeniaButtonActionPerformed(evt);
            }
        });

        polaczButton.setText("Połącz");
        polaczButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                polaczButtonActionPerformed(evt);
            }
        });

        errorTextArea.setColumns(20);
        errorTextArea.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N
        errorTextArea.setLineWrap(true);
        errorTextArea.setRows(5);
        errorTextArea.setWrapStyleWord(true);
        jScrollPane3.setViewportView(errorTextArea);

        javax.swing.GroupLayout polaczZBazaLayout = new javax.swing.GroupLayout(polaczZBaza.getContentPane());
        polaczZBaza.getContentPane().setLayout(polaczZBazaLayout);
        polaczZBazaLayout.setHorizontalGroup(
            polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(polaczLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(polaczZBazaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3)
                    .addGroup(polaczZBazaLayout.createSequentialGroup()
                        .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11)
                            .addComponent(jLabel12)
                            .addComponent(jLabel13))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(adresTextField)
                            .addGroup(polaczZBazaLayout.createSequentialGroup()
                                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(hasloTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
                                    .addComponent(loginTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)
                                    .addComponent(bazaTextField)
                                    .addComponent(portTextField))
                                .addGap(0, 0, Short.MAX_VALUE))))
                    .addGroup(polaczZBazaLayout.createSequentialGroup()
                        .addComponent(testPolaczeniaButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 210, Short.MAX_VALUE)
                        .addComponent(polaczButton)))
                .addContainerGap())
        );
        polaczZBazaLayout.setVerticalGroup(
            polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(polaczZBazaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(polaczLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(adresTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(portTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bazaTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(loginTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(hasloTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(polaczZBazaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(testPolaczeniaButton)
                    .addComponent(polaczButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE)
                .addContainerGap())
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(750, 500));

        jTabbedPane1.setMinimumSize(new java.awt.Dimension(0, 0));
        jTabbedPane1.setPreferredSize(new java.awt.Dimension(400, 200));
        jTabbedPane1.setRequestFocusEnabled(false);

        textFieldSzukaj.setMinimumSize(new java.awt.Dimension(0, 0));

        jLabel1.setText("Szukaj:");

        checkBoxNazwa.setText("Nazwa");

        checkBoxAdres.setText("Adres");

        checkBoxTelefon.setText("Telefon");

        checkBoxWWW.setText("Strona WWW");

        jScrollPane1.setHorizontalScrollBar(null);

        panelAtrakcje.setMaximumSize(new java.awt.Dimension(100, 100));
        panelAtrakcje.setLayout(new java.awt.GridLayout(1, 0));
        jScrollPane1.setViewportView(panelAtrakcje);

        jLabel2.setText("Atrakcje:");

        jScrollPane2.setHorizontalScrollBar(null);

        panelWyposazenie.setMaximumSize(new java.awt.Dimension(100, 100));
        panelWyposazenie.setLayout(new java.awt.GridLayout(1, 0));
        jScrollPane2.setViewportView(panelWyposazenie);

        jLabel3.setText("Wyposażenie:");

        jLabel4.setText("Szukaj w:");

        buttonSzukaj.setText("Szukaj");
        buttonSzukaj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSzukajActionPerformed(evt);
            }
        });

        textFieldWPoblizu.setMinimumSize(new java.awt.Dimension(0, 0));

        jLabel8.setText("w pobliżu");

        jLabel9.setText("w odl.");

        jLabel5.setText("km");

        textFieldLon.setEditable(false);
        textFieldLon.setEnabled(false);

        jButton1.setText("wyznacz współrzędne");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        textFieldLat.setEditable(false);
        textFieldLat.setEnabled(false);

        jButton3.setText("wyczyść");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jScrollPane4.setHorizontalScrollBar(null);

        panelTypyObiektu.setMaximumSize(new java.awt.Dimension(100, 100));
        panelTypyObiektu.setLayout(new java.awt.GridLayout(1, 0));
        jScrollPane4.setViewportView(panelTypyObiektu);

        jLabel6.setText("Typy obiektów:");

        jList1.setModel(list);
        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jList1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList1MouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(jList1);

        jLabel14.setText("Wyniki wyszukiwania:");

        javax.swing.GroupLayout panelObiektyLayout = new javax.swing.GroupLayout(panelObiekty);
        panelObiekty.setLayout(panelObiektyLayout);
        panelObiektyLayout.setHorizontalGroup(
            panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelObiektyLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelObiektyLayout.createSequentialGroup()
                        .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addGap(18, 18, 18)
                        .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel3)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))
                        .addGap(18, 18, 18)
                        .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelObiektyLayout.createSequentialGroup()
                                .addComponent(jLabel14)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE)))
                    .addGroup(panelObiektyLayout.createSequentialGroup()
                        .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelObiektyLayout.createSequentialGroup()
                                .addComponent(checkBoxNazwa)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkBoxAdres)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkBoxTelefon)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(checkBoxWWW)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelObiektyLayout.createSequentialGroup()
                                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(panelObiektyLayout.createSequentialGroup()
                                        .addComponent(textFieldWPoblizu, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(textFieldLat, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(textFieldLon, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(textFieldSzukaj, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(12, 12, 12)
                                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(buttonSzukaj, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(panelObiektyLayout.createSequentialGroup()
                                        .addComponent(jLabel9)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel5)))))))
                .addContainerGap())
        );
        panelObiektyLayout.setVerticalGroup(
            panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelObiektyLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textFieldSzukaj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(buttonSzukaj))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(checkBoxNazwa)
                    .addComponent(checkBoxAdres)
                    .addComponent(checkBoxTelefon)
                    .addComponent(checkBoxWWW)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textFieldWPoblizu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jLabel5)
                    .addComponent(textFieldLon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1)
                    .addComponent(textFieldLat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelObiektyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
                    .addComponent(jScrollPane2)
                    .addComponent(jScrollPane4)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Obiekty", panelObiekty);

        panelDodajObiekt.setPreferredSize(new java.awt.Dimension(602, 335));

        labelNazwa.setText("Nazwa obiektu");

        textFieldNazwa.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textFieldNazwa.setMinimumSize(new java.awt.Dimension(0, 0));

        labelAdres.setText("Adres");

        textFieldAdres.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textFieldAdres.setMinimumSize(new java.awt.Dimension(0, 0));

        labelTelefon.setText("Telefon");

        textFieldTelefon.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textFieldTelefon.setMinimumSize(new java.awt.Dimension(0, 0));

        labelWWW.setText("Strona WWW");

        textFieldWWW.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        textFieldWWW.setMinimumSize(new java.awt.Dimension(0, 0));

        labelDlugosc.setText("<html>\n<a href=\"\"> Długość geogr.<>");
        labelDlugosc.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelDlugoscMouseClicked(evt);
            }
        });

        textFieldDlugosc.setEditable(false);
        textFieldDlugosc.setEnabled(false);
        textFieldDlugosc.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                textFieldDlugoscKeyReleased(evt);
            }
        });

        labelSzerokosc.setText("<html>\n<a href=\"\"> Szerokość geogr.<>");
        labelSzerokosc.setToolTipText("<html>\n1. Wpisz adres obiektu <br/>\n2. kliknij na link <br/>\n3. wybierz z menu kontekstowego 'Pokaż współrzędne miejsca' <br/>\n4. Przepisz/przklej odpowiednie wartości GPS <br/>\nnp: 50.06918°N, 19.90964°E");
        labelSzerokosc.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelSzerokoscMouseClicked(evt);
            }
        });

        textFieldSzerokosc.setEditable(false);
        textFieldSzerokosc.setToolTipText("<html>\nNp: 50.06983 N lub 19.91038 E <br/>\nSprawdź współrzędne na mapa.targeo.pl.<br/>\nZnajdź obiekt na mapie a  później <br/>\nwybierz z menu kontekstowego \"pokaż współrzędne\"<br/>\n");
        textFieldSzerokosc.setEnabled(false);
        textFieldSzerokosc.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                textFieldSzerokoscKeyReleased(evt);
            }
        });

        labelTyp.setText("Typ obiektu");

        comboBoxTypyObiektu.setMaximumRowCount(20);
        comboBoxTypyObiektu.setMinimumSize(new java.awt.Dimension(100, 31));

        buttonZapisz.setText("Dodaj");
        buttonZapisz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonZapiszActionPerformed(evt);
            }
        });

        labelAtrakcje.setText("Atrakcje w obiekcie");

        scrollPaneAtrakcje.setHorizontalScrollBar(null);

        panelAtrakcje1.setMaximumSize(new java.awt.Dimension(100, 100));
        panelAtrakcje1.setLayout(new java.awt.GridLayout(1, 0));
        scrollPaneAtrakcje.setViewportView(panelAtrakcje1);

        tablePokoje.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                { new Integer(0),  new Integer(0),  new Integer(0)}
            },
            new String [] {
                "Liczba pokoi", "Ilość miejsc w pokoju", "Cena za osobę"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tablePokoje.setColumnSelectionAllowed(true);
        tablePokoje.setMinimumSize(new java.awt.Dimension(0, 0));
        scrollPanePokoje.setViewportView(tablePokoje);
        tablePokoje.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

        labelWyposazenie1.setText("Wyposażenie pokoi");

        scrollPaneWyposazenie1.setHorizontalScrollBar(null);
        scrollPaneWyposazenie1.setMaximumSize(new java.awt.Dimension(130, 130));

        panelWyposazenie1.setMaximumSize(new java.awt.Dimension(130, 130));
        panelWyposazenie1.setName("");
        panelWyposazenie1.setRequestFocusEnabled(false);
        panelWyposazenie1.setLayout(new java.awt.GridLayout(1, 0));
        scrollPaneWyposazenie1.setViewportView(panelWyposazenie1);

        buttonUsunWiersz.setText("Usuń wybrane wiersze");
        buttonUsunWiersz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonUsunWierszActionPerformed(evt);
            }
        });

        buttonDodajWiersz.setText("Dodaj wiersz");
        buttonDodajWiersz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonDodajWierszActionPerformed(evt);
            }
        });

        labelMiejscowosc.setText("Miejscowość");

        textFieldMiejscowosc.setToolTipText("");

        jButton2.setText("wyznacz współrzędne");
        jButton2.setMinimumSize(new java.awt.Dimension(0, 0));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        buttonUpdate.setText("Updatuj");
        buttonUpdate.setEnabled(false);
        buttonUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonUpdateActionPerformed(evt);
            }
        });

        buttonDelete.setText("Usuń");
        buttonDelete.setEnabled(false);
        buttonDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonDeleteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelDodajObiektLayout = new javax.swing.GroupLayout(panelDodajObiekt);
        panelDodajObiekt.setLayout(panelDodajObiektLayout);
        panelDodajObiektLayout.setHorizontalGroup(
            panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDodajObiektLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelDodajObiektLayout.createSequentialGroup()
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(labelAdres, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(labelNazwa, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
                            .addComponent(labelTelefon, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(labelWWW, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textFieldTelefon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(textFieldAdres, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(textFieldWWW, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(textFieldNazwa, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(labelTyp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(labelMiejscowosc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(labelDlugosc)
                            .addComponent(labelSzerokosc))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(textFieldMiejscowosc, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(comboBoxTypyObiektu, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(textFieldDlugosc, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(textFieldSzerokosc, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(panelDodajObiektLayout.createSequentialGroup()
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelAtrakcje, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(scrollPaneAtrakcje, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelDodajObiektLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(labelWyposazenie1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(47, 47, 47))
                            .addGroup(panelDodajObiektLayout.createSequentialGroup()
                                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(scrollPanePokoje, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE)
                                    .addGroup(panelDodajObiektLayout.createSequentialGroup()
                                        .addComponent(buttonDodajWiersz)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(buttonUsunWiersz, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(scrollPaneWyposazenie1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelDodajObiektLayout.createSequentialGroup()
                                        .addComponent(buttonDelete)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(buttonUpdate)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(buttonZapisz, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
                .addContainerGap())
        );
        panelDodajObiektLayout.setVerticalGroup(
            panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDodajObiektLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(comboBoxTypyObiektu, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(textFieldNazwa, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelNazwa)
                        .addComponent(labelTyp)))
                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelDodajObiektLayout.createSequentialGroup()
                        .addGap(105, 105, 105)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelDodajObiektLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textFieldAdres, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelAdres)
                            .addComponent(labelMiejscowosc)
                            .addComponent(textFieldMiejscowosc, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textFieldTelefon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelTelefon)
                            .addComponent(labelSzerokosc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(textFieldSzerokosc, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(textFieldWWW, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelWWW)
                            .addComponent(labelDlugosc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(textFieldDlugosc, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelAtrakcje, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelWyposazenie1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(scrollPaneWyposazenie1, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                    .addComponent(scrollPanePokoje, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
                    .addComponent(scrollPaneAtrakcje))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelDodajObiektLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonZapisz)
                    .addComponent(buttonUsunWiersz)
                    .addComponent(buttonDodajWiersz)
                    .addComponent(buttonUpdate)
                    .addComponent(buttonDelete))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Dodaj/Edytuj Obiekt", panelDodajObiekt);

        menuPlik.setText("Plik");

        menuItemConnect.setText("Połącz z bazą danych");
        menuItemConnect.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemConnectActionPerformed(evt);
            }
        });
        menuPlik.add(menuItemConnect);

        menuItemZamknij.setText("Zamknij");
        menuItemZamknij.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemZamknijActionPerformed(evt);
            }
        });
        menuPlik.add(menuItemZamknij);

        jMenuBar1.add(menuPlik);

        menuPomoc.setText("Pomoc");

        menuItemAbout.setText("O programie");
        menuPomoc.add(menuItemAbout);

        jMenuBar1.add(menuPomoc);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 970, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuItemZamknijActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemZamknijActionPerformed
			dispose();
    }//GEN-LAST:event_menuItemZamknijActionPerformed

    private void testPolaczeniaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_testPolaczeniaButtonActionPerformed
			errorTextArea.setText(null);

			try (Connection connection = DriverManager.getConnection(
											"jdbc:postgresql://" + adresTextField.getText() + ":" + portTextField.getText() + "/" + bazaTextField.getText(),
											loginTextField.getText(), hasloTextField.getText())) {
				errorTextArea.setText("Połączono z bazą danych");
			} catch (SQLException ex) {
				errorTextArea.setText("Błąd!: " + ex.getMessage());
				Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
			}
    }//GEN-LAST:event_testPolaczeniaButtonActionPerformed

    private void menuItemConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemConnectActionPerformed
			polaczZBaza.setVisible(true);
    }//GEN-LAST:event_menuItemConnectActionPerformed

    private void polaczButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_polaczButtonActionPerformed
			connectionString = "jdbc:postgresql://" + adresTextField.getText() + ":" + portTextField.getText() + "/" + bazaTextField.getText();
			login = loginTextField.getText();
			password = hasloTextField.getText();
			try {
				getConnection();
				jTabbedPane1.setVisible(true);
				polaczZBaza.setVisible(false);
			} catch (SQLException ex) {
				errorTextArea.setText("Błąd!: " + ex.getMessage());
				Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
			}

    }//GEN-LAST:event_polaczButtonActionPerformed

	private void buttonDodajWierszActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDodajWierszActionPerformed
		DefaultTableModel model = (DefaultTableModel) tablePokoje.getModel();
		model.insertRow(tablePokoje.getRowCount(), new Object[]{0, 0, 0});
	}//GEN-LAST:event_buttonDodajWierszActionPerformed

	private void buttonUsunWierszActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUsunWierszActionPerformed
		DefaultTableModel model = (DefaultTableModel) tablePokoje.getModel();
		int row;
		while ((row = tablePokoje.getSelectedRow()) != -1) {
			model.removeRow(row);
		}
	}//GEN-LAST:event_buttonUsunWierszActionPerformed
	private void buttonZapiszActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonZapiszActionPerformed
		StringBuilder values = new StringBuilder();
		values.append("'").append(textFieldNazwa.getText()).append("',");
		values.append("'").append(textFieldMiejscowosc.getText()).append(", ").append(textFieldAdres.getText()).append("',");
		boolean error = false;
		String errorText = "";
		if ("".equals(textFieldAdres.getText())) {
			error = true;
			errorText += "Adres";
		}
		if ("".equals(textFieldMiejscowosc.getText())) {
			error = true;
			errorText += " Miejscowość";
		}
		if ("".equals(textFieldNazwa.getText())) {
			error = true;
			errorText += " Nazwa";
		}
		if ("".equals(textFieldTelefon.getText())) {
			error = true;
			errorText += " Telefon";
		}
		if ("".equals(textFieldDlugosc.getText())) {
			error = true;
			errorText += " Współrzędne";
		}
		if (error) {
			JOptionPane.showMessageDialog(null, "Pola " + errorText + " są wymagane!");
			return;
		}
		try {
			tablePokoje.editCellAt(0, 0); //aby zapisały się zmiany w edytowanej komórce
			tablePokoje.editCellAt(0, 1);
			SqlQueries.Insert(Tabele.miasta, "nazwa, dlugosc, szerokosc",
							"'" + textFieldMiejscowosc.getText() + "',"
							+ textFieldDlugosc.getText() + "," + textFieldSzerokosc.getText(), null);
			values.append(textFieldDlugosc.getText()).append(", ");
			values.append(textFieldSzerokosc.getText()).append(", ");
			values.append("'").append(textFieldTelefon.getText()).append("',");
			values.append("'").append(textFieldWWW.getText()).append("',");
			values.append("'").append(((IndeksWartosc) comboBoxTypyObiektu.getSelectedItem()).indeks).append("'");


			ResultSet rs = SqlQueries.Insert(Tabele.obiekty, "nazwa, adres, dlugosc, szerokosc, telefon, strona_www, typ", values.toString(), "id");
			rs.next();
			int idObiektu = rs.getInt("id");
			for (Component c : panelAtrakcje1.getComponents()) {
				if (c instanceof JCheckBox && ((JCheckBox) c).isSelected()) {
					String idAtrakcji = ((JCheckBox) c).getName();
					SqlQueries.Insert(Tabele.obiekty_atrakcje, "", idObiektu + "," + idAtrakcji, null);
				}
			}
			for (Component c : panelWyposazenie1.getComponents()) {
				if (c instanceof JCheckBox && ((JCheckBox) c).isSelected()) {
					String idWyposazenia = ((JCheckBox) c).getName();
					SqlQueries.Insert(Tabele.obiekty_wyposazenie, "", idObiektu + "," + idWyposazenia, null);
				}
			}
			int size = tablePokoje.getRowCount();
			String liczbaPokoi, iloscMiejsc, cena;
			for (int i = 0; i < size; ++i) {
				liczbaPokoi = tablePokoje.getValueAt(i, 0) + "";
				iloscMiejsc = tablePokoje.getValueAt(i, 1) + "";
				cena = tablePokoje.getValueAt(i, 2) + "";
				SqlQueries.Insert(Tabele.obiekty_pokoje, "", idObiektu + "," + liczbaPokoi + "," + iloscMiejsc + "," + cena, null);
			}
			JOptionPane.showMessageDialog(null, "Zapisano");
		} catch (SQLException | HeadlessException ex) {
			JOptionPane.showMessageDialog(null, ex.getMessage());
		}
	}//GEN-LAST:event_buttonZapiszActionPerformed

	private void labelSzerokoscMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelSzerokoscMouseClicked
		RunBrowser.runBrowser("www.mapa.targeo.pl/" + textFieldMiejscowosc.getText() + "," + textFieldAdres.getText());
	}//GEN-LAST:event_labelSzerokoscMouseClicked

	private void labelDlugoscMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelDlugoscMouseClicked
		RunBrowser.runBrowser("www.mapa.targeo.pl/" + textFieldMiejscowosc.getText() + "," + textFieldAdres.getText());
	}//GEN-LAST:event_labelDlugoscMouseClicked

	private void textFieldDlugoscKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textFieldDlugoscKeyReleased
		String text = textFieldDlugosc.getText();
		if (text.contains(",") && textFieldSzerokosc.getText().equals("")) {
			textFieldDlugosc.setText(text.split(",")[1]);
			textFieldSzerokosc.setText(text.split(",")[0]);
		}
	}//GEN-LAST:event_textFieldDlugoscKeyReleased

	private void textFieldSzerokoscKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textFieldSzerokoscKeyReleased
		String text = textFieldSzerokosc.getText();
		if (text.contains(",") && textFieldDlugosc.getText().equals("")) {
			textFieldDlugosc.setText(text.split(",")[1]);
			textFieldSzerokosc.setText(text.split(",")[0]);
		}
	}//GEN-LAST:event_textFieldSzerokoscKeyReleased

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
			final Geocoder geocoder = new Geocoder();
			GeocoderRequest geocoderRequest = new GeocoderRequestBuilder().setAddress(textFieldWPoblizu.getText()).setLanguage("pl").getGeocoderRequest();
			GeocodeResponse geocoderResponse = geocoder.geocode(geocoderRequest);
			if (geocoderResponse.getResults().isEmpty()) {
				JOptionPane.showMessageDialog(null, "Nie znaleziono miejscowości o podanej nazwie.");
			} else if (geocoderResponse.getResults().size() > 1) {

				Object[] names = new GeocoderResult[geocoderResponse.getResults().size()];
				int i = 0;
				for (GeocoderResult gr : geocoderResponse.getResults()) {
					names[i++] = gr;
				}

				Object o = JOptionPane.showInputDialog(null, "Wybierz miejscowość:", "Niejednoznaczne zapytanie.",
								JOptionPane.QUESTION_MESSAGE, null, names, names[0]);
				textFieldLat.setText(((GeocoderResult) o).getGeometry().getLocation().getLat().round(new MathContext(5)).toPlainString());
				textFieldLon.setText(((GeocoderResult) o).getGeometry().getLocation().getLng().round(new MathContext(5)).toPlainString());

			} else {
				Object o = geocoderResponse.getResults().toArray()[0];
				textFieldLat.setText(((GeocoderResult) o).getGeometry().getLocation().getLat().round(new MathContext(5)).toPlainString());
				textFieldLon.setText(((GeocoderResult) o).getGeometry().getLocation().getLng().round(new MathContext(5)).toPlainString());
			}



    }//GEN-LAST:event_jButton1ActionPerformed

    private void buttonSzukajActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSzukajActionPerformed
			StringBuilder str = new StringBuilder();

			List<String> atr = new LinkedList<>();
			List<String> wyp = new LinkedList<>();
			for (Component c : panelAtrakcje.getComponents()) {
				if (c instanceof JCheckBox && ((JCheckBox) c).isSelected()) {
					atr.add(((JCheckBox) c).getName());
				}
			}
			for (Component c : panelWyposazenie.getComponents()) {
				if (c instanceof JCheckBox && ((JCheckBox) c).isSelected()) {
					wyp.add(((JCheckBox) c).getName());
				}
			}

			str.append("select id,nazwa,adres from obiekty ");
			if (!atr.isEmpty()) {
				str.append("join obiekty_atrakcje on (id=obiekt)");
			}
			//if(!wyp.isEmpty()) str.append("join obiekty_wyposazenie ");
			str.append("where ");
			boolean first = true;
			boolean szukaj = false;
			boolean odl = false;
			if (!textFieldLat.getText().isEmpty()) {
				odl = true;
				str.append("calculate_distance_plpgsql(szerokosc,dlugosc,").append(textFieldLat.getText()).append(",").append(textFieldLon.getText()).append(") <= ").append(jSpinner1.getValue());
			}
			if ((checkBoxNazwa.isSelected() || checkBoxAdres.isSelected() || checkBoxTelefon.isSelected() || checkBoxWWW.isSelected()) && textFieldSzukaj.getText() != null) {
				if (odl) {
					str.append(" and ");
				}
				szukaj = true;
				if (checkBoxNazwa.isSelected() && textFieldSzukaj.getText() != null) {
					if (!first) {
						str.append(" or ");
					} else {
						str.append(" ( ");
					}
					str.append("nazwa like(\'%").append(textFieldSzukaj.getText()).append("%\')");
					first = false;
				}
				if (checkBoxAdres.isSelected() && textFieldSzukaj.getText() != null) {
					if (!first) {
						str.append(" or ");
					} else {
						str.append(" ( ");
					}
					str.append("adres like(\'%").append(textFieldSzukaj.getText()).append("%\')");
					first = false;
				}
				if (checkBoxTelefon.isSelected() && textFieldSzukaj.getText() != null) {
					if (!first) {
						str.append(" or ");
					} else {
						str.append(" ( ");
					}
					str.append("telefon like(\'%").append(textFieldSzukaj.getText()).append("%\')");
					first = false;
				}
				if (checkBoxWWW.isSelected() && textFieldSzukaj.getText() != null) {
					if (!first) {
						str.append(" or ");
					} else {
						str.append(" ( ");
					}
					str.append("strona_www like(\'%").append(textFieldSzukaj.getText()).append("%\')");
					first = false;
				}

				str.append(" )");
			}

			first = true;
			boolean typy = false;
			for (Component c : panelTypyObiektu.getComponents()) {
				if (c instanceof JCheckBox && ((JCheckBox) c).isSelected()) {
					String x = ((JCheckBox) c).getName();
					if (!first) {
						str.append(" or ");

					} else {
						if (szukaj || odl) {
							str.append(" and ");
						}
						str.append("(");
						typy = true;
						first = false;
					}
					str.append("typ = ").append(x).append(" ");
				}
			}

			if (typy) {
				str.append(")");
			}

			first = true;
			for (String s : atr) {
				if (!first) {
					str.append(" or ");

				} else {
					if (szukaj || odl || typy) {
						str.append(" and ");
					}
					str.append("(");
					first = false;
				}
				str.append("atrakcja = ").append(s).append(" ");
			}
			if (!atr.isEmpty()) {
				str.append(") group by id,nazwa,adres having count(*)=").append(atr.size());
			}


			if (!wyp.isEmpty()) {
				first = true;
				String zap = str.toString();
				str = new StringBuilder();
				str.append("select id,nazwa,adres from (");
				str.append(zap);
				str.append(") as a join obiekty_wyposazenie on(id=obiekt) where ");
				for (String s : wyp) {
					if (!first) {
						str.append(" or ");

					} else {
						first = false;
					}
					str.append("wyposazenie = ").append(s).append(" ");
				}
				str.append(" group by id,nazwa,adres having count(*)=").append(wyp.size());
			}

			str.append(";");
			list.clear();
			String query = str.toString();
			try {
				statement = connection.createStatement();
				try {
					ResultSet res = statement.executeQuery(query);
					//res.next();
					while (res.next()) {
						IndeksWartosc iw = new IndeksWartosc(res.getInt("id"), res.getString("nazwa") + " (" + res.getString("adres") + ")");
						list.addElement(iw);
					}

				} catch (SQLException ex) {
					Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
				}
			} catch (SQLException ex) {
				Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
			}




			System.out.println(query);


    }//GEN-LAST:event_buttonSzukajActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
			final Geocoder geocoder = new Geocoder();
			GeocoderRequest geocoderRequest = new GeocoderRequestBuilder().setAddress(textFieldMiejscowosc.getText()).setLanguage("pl").getGeocoderRequest();
			GeocodeResponse geocoderResponse = geocoder.geocode(geocoderRequest);
			if (geocoderResponse.getResults().isEmpty()) {
				JOptionPane.showMessageDialog(null, "Nie znaleziono miejscowości o podanej nazwie.");
			} else if (geocoderResponse.getResults().size() > 1) {

				Object[] names = new GeocoderResult[geocoderResponse.getResults().size()];
				int i = 0;
				for (GeocoderResult gr : geocoderResponse.getResults()) {
					names[i++] = gr;
				}

				Object o = JOptionPane.showInputDialog(null, "Wybierz miejscowość:", "Niejednoznaczne zapytanie.",
								JOptionPane.QUESTION_MESSAGE, null, names, names[0]);
				textFieldSzerokosc.setText(((GeocoderResult) o).getGeometry().getLocation().getLat().round(new MathContext(5)).toPlainString());
				textFieldDlugosc.setText(((GeocoderResult) o).getGeometry().getLocation().getLng().round(new MathContext(5)).toPlainString());

			} else {
				Object o = geocoderResponse.getResults().toArray()[0];
				textFieldSzerokosc.setText(((GeocoderResult) o).getGeometry().getLocation().getLat().round(new MathContext(5)).toPlainString());
				textFieldDlugosc.setText(((GeocoderResult) o).getGeometry().getLocation().getLng().round(new MathContext(5)).toPlainString());
			}
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
			textFieldLat.setText(null);
			textFieldLon.setText(null);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked
			ResultWindow win = new ResultWindow(((IndeksWartosc) jList1.getSelectedValue()).indeks, this);
			win.setLocationRelativeTo(this);
			win.setVisible(true);
    }//GEN-LAST:event_jList1MouseClicked

    private void buttonUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUpdateActionPerformed
        try {
            statement = connection.createStatement();
            String query =
                    "delete from obiekty_atrakcje where obiekt = " + idToUpdate + "; "
                    + "delete from obiekty_wyposazenie where obiekt = " + idToUpdate + "; "
                    + "delete from obiekty_pokoje where obiekt = " + idToUpdate + "; "
                    + "delete from komentarze where obiekt = " + idToUpdate + "; ";

            statement.executeUpdate(query);

            query = "update obiekty set nazwa = \'" + textFieldNazwa.getText() + "\', adres = \'" + textFieldAdres.getText() + "\', telefon = \'" + textFieldTelefon.getText() + "\', strona_www = \'" + textFieldWWW.getText() + "\', typ = " + ((IndeksWartosc) comboBoxTypyObiektu.getSelectedItem()).indeks + ", dlugosc = " + textFieldDlugosc.getText() + ", szerokosc = " + textFieldSzerokosc.getText() + " where id = " + idToUpdate + ";";
            System.out.println(query);
            statement.executeUpdate(query);

            int idObiektu = idToUpdate;
            for (Component c : panelAtrakcje1.getComponents()) {
                if (c instanceof JCheckBox && ((JCheckBox) c).isSelected()) {
                    String idAtrakcji = ((JCheckBox) c).getName();
                    SqlQueries.Insert(Tabele.obiekty_atrakcje, "", idObiektu + "," + idAtrakcji, null);
                }
            }
            for (Component c : panelWyposazenie1.getComponents()) {
                if (c instanceof JCheckBox && ((JCheckBox) c).isSelected()) {
                    String idWyposazenia = ((JCheckBox) c).getName();
                    SqlQueries.Insert(Tabele.obiekty_wyposazenie, "", idObiektu + "," + idWyposazenia, null);
                }
            }
            int size = tablePokoje.getRowCount();
            String liczbaPokoi, iloscMiejsc, cena;
            for (int i = 0; i < size; ++i) {
                liczbaPokoi = tablePokoje.getValueAt(i, 0) + "";
                iloscMiejsc = tablePokoje.getValueAt(i, 1) + "";
                cena = tablePokoje.getValueAt(i, 2) + "";
                SqlQueries.Insert(Tabele.obiekty_pokoje, "", idObiektu + "," + liczbaPokoi + "," + iloscMiejsc + "," + cena, null);
            }
            JOptionPane.showMessageDialog(null, "Zaktualizowano.");
            buttonSzukajActionPerformed(evt);



        } catch (SQLException ex) {
            Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_buttonUpdateActionPerformed

    private void buttonDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDeleteActionPerformed

        try {
            statement = connection.createStatement();
            statement.executeUpdate("delete from obiekty_atrakcje where obiekt = " + idToUpdate + "; ");
            statement.executeUpdate("delete from obiekty_wyposazenie where obiekt = " + idToUpdate + "; ");
            statement.executeUpdate("delete from obiekty_pokoje where obiekt = " + idToUpdate + "; ");
            if (statement.executeUpdate("delete from obiekty where id=" + idToUpdate + ";") > 0) {
                JOptionPane.showMessageDialog(this, "Pomyślnie usunięto obiekt.");
                buttonUpdate.setEnabled(false);
                buttonDelete.setEnabled(false);
                idToUpdate = -1;
                buttonSzukajActionPerformed(evt);

				}
			} catch (SQLException ex) {
				Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
			}


    }//GEN-LAST:event_buttonDeleteActionPerformed
	public static void main(String args[]) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());




		} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
			Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
		}
		java.awt.EventQueue.invokeLater(new Runnable() {

			@Override
			public void run() {
				new MainWindow().setVisible(true);
			}
		});
	}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField adresTextField;
    private javax.swing.JTextField bazaTextField;
    private javax.swing.JButton buttonDelete;
    private javax.swing.JButton buttonDodajWiersz;
    private javax.swing.JButton buttonSzukaj;
    private javax.swing.JButton buttonUpdate;
    private javax.swing.JButton buttonUsunWiersz;
    private javax.swing.JButton buttonZapisz;
    private javax.swing.JCheckBox checkBoxAdres;
    private javax.swing.JCheckBox checkBoxNazwa;
    private javax.swing.JCheckBox checkBoxTelefon;
    private javax.swing.JCheckBox checkBoxWWW;
    private javax.swing.JComboBox comboBoxTypyObiektu;
    private javax.swing.JTextArea errorTextArea;
    private javax.swing.JTextField hasloTextField;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JList jList1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JSpinner jSpinner1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel labelAdres;
    private javax.swing.JLabel labelAtrakcje;
    private javax.swing.JLabel labelDlugosc;
    private javax.swing.JLabel labelMiejscowosc;
    private javax.swing.JLabel labelNazwa;
    private javax.swing.JLabel labelSzerokosc;
    private javax.swing.JLabel labelTelefon;
    private javax.swing.JLabel labelTyp;
    private javax.swing.JLabel labelWWW;
    private javax.swing.JLabel labelWyposazenie1;
    private javax.swing.JTextField loginTextField;
    private javax.swing.JMenuItem menuItemAbout;
    private javax.swing.JMenuItem menuItemConnect;
    private javax.swing.JMenuItem menuItemZamknij;
    private javax.swing.JMenu menuPlik;
    private javax.swing.JMenu menuPomoc;
    private javax.swing.JPanel panelAtrakcje;
    private javax.swing.JPanel panelAtrakcje1;
    private javax.swing.JPanel panelDodajObiekt;
    private javax.swing.JPanel panelObiekty;
    private javax.swing.JPanel panelTypyObiektu;
    private javax.swing.JPanel panelWyposazenie;
    private javax.swing.JPanel panelWyposazenie1;
    private javax.swing.JToggleButton polaczButton;
    private javax.swing.JLabel polaczLabel;
    private javax.swing.JDialog polaczZBaza;
    private javax.swing.JTextField portTextField;
    private javax.swing.JScrollPane scrollPaneAtrakcje;
    private javax.swing.JScrollPane scrollPanePokoje;
    private javax.swing.JScrollPane scrollPaneWyposazenie1;
    private javax.swing.JTable tablePokoje;
    private javax.swing.JToggleButton testPolaczeniaButton;
    private javax.swing.JTextField textFieldAdres;
    private javax.swing.JTextField textFieldDlugosc;
    private javax.swing.JTextField textFieldLat;
    private javax.swing.JTextField textFieldLon;
    private javax.swing.JTextField textFieldMiejscowosc;
    private javax.swing.JTextField textFieldNazwa;
    private javax.swing.JTextField textFieldSzerokosc;
    private javax.swing.JTextField textFieldSzukaj;
    private javax.swing.JTextField textFieldTelefon;
    private javax.swing.JTextField textFieldWPoblizu;
    private javax.swing.JTextField textFieldWWW;
    // End of variables declaration//GEN-END:variables
}
